package br.com.listadecompras.activities;

import br.com.listadecompras.model.Item;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

public class AdicionarItemActivity extends Activity {

	public static final int CODIGO_ACTIVITY = 90;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.setContentView(R.layout.adiciona_item);
	}
	
	public void callAddItemToList(View view) {
		
		EditText nome = (EditText) this.findViewById(R.id.txtTitleItem);
		EditText descricao = (EditText) this.findViewById(R.id.txtDescription);
		
		Intent retorno = new Intent();
		retorno.putExtra(Item.NOME, nome.getText().toString());
		retorno.putExtra(Item.DESCRICAO, descricao.getText().toString());
		setResult(RESULT_OK, retorno);
		finish();
	}
	
	public void callCancel(View view) {
		finish();
	}
}
